package com.smartfactory.sail.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smartfactory.sail.vo.PageParam;

/**
 * @author 王巨壁
 * @title: PageUtils
 * @projectName smart-sail
 * @description: 创建分页基本信息
 * @date 2019/8/213:39
 */
public class PageUtils {

    public static  Page createPage(Page page, PageParam pageParam) {

        page.setSize(pageParam.getSize());
        page.setCurrent(pageParam.getCurrentPage());
        if (pageParam.getSortType() == 2) {//升序
            page.setDesc(pageParam.getSortField());
        } else {
            page.setAsc(pageParam.getSortField());
        }
        return page;
    }
}
